<?php /*a:1:{s:64:"D:\phpstudy_pro\WWW\shejiao-back\app\admin\view\login\index.html";i:1694741333;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>登入 - <?php echo xn_cfg('base.sys_name'); ?></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/admin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/admin/style/layuiAdmin.css" media="all">
    <link rel="stylesheet" href="/static/admin/style/login.css" media="all">
</head>
<body>
<link rel="stylesheet" href="/static/admin/css/login.css" media="all">
<div class="main-body">
    <div class="login-main">
        <div class="login-top">
            <span><?php echo xn_cfg('base.sys_name'); ?></span>
            <span class="bg1"></span>
            <span class="bg2"></span>
        </div>
        <div class="layui-form login-bottom">
            <div class="demo<?php if(!$demo): ?> layui-hide<?php endif; ?>">用户名:admin 密码:123456</div>
            <div class="center">

                <div class="item">
                    <span class="icon icon-2"></span>
                    <input type="text" id="username" lay-verify="required"  placeholder="请输入登录账号" maxlength="24"/>
                </div>

                <div class="item">
                    <span class="icon icon-3"></span>
                    <input type="password" id="password" lay-verify="required"  placeholder="请输入密码" maxlength="20">
                    <span class="bind-password icon icon-4"></span>
                </div>

                <?php if(xn_cfg('base.login_vercode') == 1): ?>
                <div id="validatePanel" class="item" style="width: 137px;">
                    <input type="text" id="captcha" placeholder="请输入验证码" maxlength="4">
                    <img id="vercode" class="validateImg"  src="<?php echo url('login/verify'); ?>">
                </div>
                <?php endif; ?>

            </div>
            <!-- <div class="tip">
                <span class="icon-nocheck"></span>
                <span class="login-tip">保持登录</span>
                <a href="javascript:" class="forget-password">忘记密码？</a>
            </div> -->
            <div class="layui-form-item" style="text-align:center; width:100%;height:100%;margin:0px;">
                <button class="login-btn" id="tijiao">立即登录</button>
            </div>
        </div>
    </div>
</div>

<script src="/static/admin/layui/layui.js"></script>
<script src="/static/admin/js/jquery-2.0.0.min.js"></script>
<script>
    layui.use(['layer', 'form', 'jquery'], function(){
        var $ = layui.$;
        $(document).keyup(function(event){
            if(event.keyCode ==13){
                $('#tijiao').click()
            }
        });
        $(document).on('click','#tijiao',function(){
            var username = $('#username').val();
            console.log(username);
            if(!username){
                layer.msg('请输入用户名');
                username.focus();
                return false;
            }
            var password = $('#password').val();
            if(!password){
                layer.msg('请输入密码');
                password.focus();
                return false;
            }
            <?php if(xn_cfg('base.login_vercode') == 1): ?>
            var captcha = $('#captcha').val();
            if(!captcha){
                layer.msg('请输入验证码');
                captcha.focus();
                return false;
            }
            <?php else: ?>
            var captcha = '';
            <?php endif; ?>

                $.ajax({
                    type: "post",
                    url:"<?php echo url('login/index'); ?>",
                    data:{username:username,password:password,vercode:captcha},
                    dataType:"json",
                    success:function(data){
                        if( data.code == 1 ) {
                            layer.msg('登入成功', {
                                offset: '15px'
                                ,icon: 1
                                ,time: 1000
                            }, function(){
                                location.href = "<?php echo url('index/index'); ?>"; //后台主页
                            });
                        } else {
                            layer.msg(data.msg);
                        }
                    },
                    error:function(data){
                        console.log(data);
                    }
                });
            });
            $('#vercode').click(function () {
                $(this).attr('src', "<?php echo url('login/verify'); ?>?" + Date.parse(new Date()))
            })
        });

</script>
</body>
</html>